<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'edit';
$return=array();
$return['tpltypes']=array('0'=>'餐饮行业','1'=>'IT科技');
$return['tplkfs']=array('0'=>'客户通知模板','1'=>'店员通知模板');
if($_RQ['op']=='edit'){
	$item1=$this->plugin_setting('basic');
	$item2=$this->plugin_setting('message_tpl');
	$item=array_merge($item1,$item2);
	$footernav =array(
		array('title'=>'首页','icon'=>'icon-shouye','action'=>'jy_dish/index/'),
		array('title'=>'订单','icon'=>'icon-quanbudingdan','action'=>'jy_dish/order_show/'),
		array('title'=>'我的','icon'=>'icon-wo1','action'=>'jy_dish/myhome/'),
	);
	$plugins =$this->plugins();
    $return['item']=$item;
	$return['item']['footernav']=$return['item']['footernav']?$return['item']['footernav']:$footernav;
	$return['item']['plugins']=$return['item']['plugins']?$return['item']['plugins']:$plugins[1]['list'];
	$htmls=array(
		'type'=>'edit',
		'post'=>'post',
		'desc'=>'系统设置',
		'edit_tab'=>true,
		'edits'=>array(
			array(
				'title'=>'基本参数',
				'list'=>array(
					array('type'=>'string','title'=>'网站名称','name'=>'title'),
					array('type'=>'image','title'=>'网站logo','name'=>'logo'),
					array('type'=>'string','title'=>'首页商家称呼','name'=>'storecall','help'=>'默认是：《商家》，可以改成《门店》'),
					array('type'=>'string','title'=>'分享标题','name'=>'share_title'),
					array('type'=>'image','title'=>'分享图片','name'=>'share_image'),
					array('type'=>'string','title'=>'分享描述','name'=>'share_desc'),
				)
			),
			array(
				'title'=>'消息模版',
				'list'=>array(
					array('type'=>'switch','title'=>'是否开启模板消息','name'=>'istpl','help'=>'关闭则发送客服消息！(温馨提示：客服消息48小时内，客户必须跟公众号存在交互行为，比如发送消息给公众号，否则不推送信息！)'),
					array('type'=>'radio','title'=>'行业类型','name'=>'tpltype', 'options'=>'tpltypes'),
					array('type'=>'radio','title'=>'模板消息类型','name'=>'tplkf', 'options'=>'tplkfs'),
					array('type'=>'string','title'=>'叫号消息模版','name'=>'call','show'=>array('tplkf','0'),'help'=>'a.餐饮行业在模板库选择行业餐饮－餐饮，搜索“排号通知”编号为OPENTM383288748的模板</br>b.IT科技行业在模板库选择行业IT科技－互联网|电子商务，搜索“排号提醒通知”编号为OPENTM205984119的模板'),
					array('type'=>'string','title'=>'队列更新消息模版','name'=>'queue_update','show'=>array('tplkf','0'),'help'=>'a.餐饮行业在模板库选择行业餐饮－餐饮，搜索“呼叫服务员提醒”编号为OPENTM400182254的模板</br>b.IT科技行业在模板库选择行业IT科技－互联网|电子商务，搜索“服务状态提醒”编号为OPENTM401684051的模板'),
					array('type'=>'string','title'=>'呼叫服务员','name'=>'waiter','show'=>array('tplkf','0'),'help'=>'a.餐饮行业在模板库选择行业餐饮－餐饮，搜索“呼叫服务员提醒”编号为OPENTM400182254的模板</br>b.IT科技行业在模板库选择行业IT科技－互联网|电子商务，搜索“服务状态提醒”编号为OPENTM401684051的模板'),
					array('type'=>'string','title'=>'订单状态变更','name'=>'order_change','show'=>array('tplkf','0'),'help'=>'a.餐饮行业在模板库选择行业餐饮－餐饮，搜索“订单状态提醒”编号为OPENTM202045454的模板,</br>b.IT科技行业在模板库选择行业IT科技－互联网|电子商务，搜索“订单状态提醒”编号为OPENTM206848054的模板'),
					array('type'=>'string','title'=>'新订单通知','name'=>'order_new','show'=>array('tplkf','0'),'help'=>'a.餐饮行业-选择行业餐饮－餐饮，搜索“下单成功提醒”编号为OPENTM414289847'),
					array('type'=>'string','title'=>'订单付款通知','name'=>'order_pay','show'=>array('tplkf','0'),'help'=>'a.餐饮行业-选择行业餐饮－餐饮，搜索“订单状态提醒”编号为OPENTM202045454'),
					array('type'=>'string','title'=>'自取下单通知','name'=>'salf_order_new','show'=>array('tplkf','0'),'help'=>'a.餐饮行业-选择行业餐饮－餐饮，搜索“下单成功通知”编号为OPENTM405555608'),
					array('type'=>'string','title'=>'取餐成功通知','name'=>'qu_order','show'=>array('tplkf','0'),'help'=>'a.餐饮行业-选择行业餐饮－餐饮，搜索“取餐成功通知”编号为OPENTM410712268'),
					array('type'=>'string','title'=>'预定成功通知','name'=>'yuding_order_new','show'=>array('tplkf','0'),'help'=>'a.餐饮行业-选择行业餐饮－餐饮，搜索“预定成功通知”编号为OPENTM207497714'),
					array('type'=>'string','title'=>'店员-订单付款通知','name'=>'kf_order_pay','show'=>array('tplkf','1'),'help'=>'a.餐饮行业-选择行业餐饮－餐饮，搜索“订单状态提醒”编号为OPENTM202045454；</br>b.IT科技行业在模板库选择行业IT科技－互联网|电子商务，搜索“餐饮支付成功通知”编号为OPENTM207696129的模板'),
					array('type'=>'string','title'=>'店员-新订单通知','name'=>'kf_order_new','show'=>array('tplkf','1'),'help'=>'a.餐饮行业-选择行业餐饮－餐饮，搜索“新订单通知”编号为OPENTM203405336；</br>b,IT科技行业搜索“新订单通知”编号为：OPENTM203353600'),
					array('type'=>'string','title'=>'服务员被呼叫','name'=>'kf_waiter','show'=>array('tplkf','1'),'help'=>'a.餐饮行业在模板库选择行业餐饮－餐饮，搜索“呼叫服务员提醒”编号为OPENTM400182254的模板</br>b.IT科技行业在模板库选择行业IT科技－互联网|电子商务，搜索“服务状态提醒”编号为OPENTM401684051的模板'),
					
				)
			),
			array(
				'title'=>'幻灯片',
				'list'=>array(
					array(
						'type'=>'array',
						'name'=>'hdps',
						'add_tip'=>'添加一个幻灯片',
							'list'=>array(
								array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片'),
								array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
								
							),
							'details'=>array(
								array('type'=>'image','name'=>'picurl','title'=>'幻灯片图片','help'=>''),
								array('type'=>'string','name'=>'url','title'=>'幻灯片链接'),
								
							)
				),
				)
			),
			array(
					'title'=>'欢迎幻灯片',
					'list'=>array(
								array('type'=>'switch','title'=>'开启欢迎页面','name'=>'iswelcome','help'=>'开启后，访问首页会先进入欢迎页面！'),
								array('type'=>'array','title'=>'欢迎幻灯片','name'=>'welcomehdps','add_tip'=>'添加一个欢迎幻灯片',
										'list'=>array(
											array('type'=>'string','name'=>'title','title'=>'标题'),
											array('type'=>'image','name'=>'picurl','title'=>'图片'),
											array('type'=>'string','name'=>'url','title'=>'地址'),
										),
										'details'=>array(
											array('type'=>'string','name'=>'title','title'=>'标题'),
											array('type'=>'string','name'=>'desc','title'=>'描述'),
											array('type'=>'image','name'=>'picurl','title'=>'图片','help'=>'推荐尺寸：750*900'),
											array('type'=>'link','name'=>'url','from'=>'action','title'=>'地址'),
										)
								),
					)
				),
			array(
				'title'=>'底部导航',
					'list'=>array(
									array('type'=>'array','name'=>'footernav','add_tip'=>'添加一个底部导航',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标'),
										array('type'=>'string','name'=>'action','title'=>'导航链接'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'导航名称'),
										array('type'=>'icon','name'=>'icon','from'=>'jinyunicon','title'=>'导航图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'link','name'=>'action','from'=>'action','title'=>'导航链接'),
									)
								),
					)
			),
			array(
				'title'=>'辅助应用',
					'list'=>array(
									array('type'=>'array','name'=>'plugins','add_tip'=>'添加一个辅助应用',
									'list'=>array(
										array('type'=>'string','name'=>'title','title'=>'应用名称'),
										array('type'=>'string','name'=>'desc','title'=>'应用描述'),
										array('type'=>'icon','name'=>'icon','title'=>'应用图标'),
										array('type'=>'string','name'=>'name','title'=>'应用标识'),							
									),
									'details'=>array(
										array('type'=>'string','name'=>'title','title'=>'应用名称'),
										array('type'=>'choose','action'=>'core/basic.get_plugins/','name'=>'name','title'=>'应用标识','choose_title'=>'选择应用'),
										array('type'=>'icon','name'=>'icon','title'=>'应用图标','help'=>'图标，例如：icon-shouye'),							
										array('type'=>'string','name'=>'desc','title'=>'应用描述'),
									)
								),
					)
			),
			),
			);
	$return['htmls']=$htmls;
	set_html('framess',$this->menu());
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$data=array_fields(array('logo','share_title','title','share_image','share_desc','hdps','plugins','footernav','storecall'),$postdata);
	$this->plugin_setting('basic',$data);
	$data=array_fields(array('istpl','tpltype','call','queue_update','waiter','order_change','order_new','order_pay','kf_order_pay','kf_order_new','kf_waiter','salf_order_new','qu_order','yuding_order_new'),$postdata);
	$this->plugin_setting('message_tpl',$data);
	exi('设置成功');
}
?>